import * as fs from "fs";
import * as path from "path";

let dir = process.cwd();
let file = `$dir = "${dir}\\";
$bun = $dir + "bun.exe";
$script = $dir + "build.ts";

. $bun $script $arguments $args`;

fs.writeFileSync("build.ps1", file);

dir = path.join(dir, "loader.ts").replace(/\\/g, "/");
file = `import { BuildAsm } from "${dir}";
BuildAsm();

// @ts-ignore
await Bun.sleep(2000);`;

fs.writeFileSync("build.ts", file);
